package echarts

import (
	"github.com/astaxie/beego"
	"github.com/astaxie/beego/orm"
)

type EchartsBusinessController struct {
	beego.Controller
}

func (c *EchartsBusinessController) Get() {

	c.TplName = "echarts/echarts-business.html"
}

func (c *EchartsBusinessController) GetBusinessChart() {
	// 数据库查询
	o := orm.NewOrm()

	// 创建列表容器
	var caiwu_date orm.ParamsList
	var student_incress orm.ParamsList

	// 查询结果存入容器
	o.Raw("select caiwu_date from sys_caiwu_data").ValuesFlat(&caiwu_date)
	o.Raw("select student_incress from sys_caiwu_data").ValuesFlat(&student_incress)

	// 使用ajax交互
	mapData := map[string]interface{}{}
	mapData["caiwu_date"] = caiwu_date
	mapData["student_incress"] = student_incress

	c.Data["json"] = mapData
	c.ServeJSON()

}
